fix: only set BASIC_MEMORY_ENV=test during pytest runs #482
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #481
Problem
The alembic/env.py module was unconditionally setting
BASIC_MEMORY_ENV='test'at import time, which causedconfig.is_test_envto always return True. This prevented the MCP server from starting the file watch service, breaking file sync for external changes.Solution
Only set the env var when
PYTEST_CURRENT_TESTis set, indicating an actual pytest run. This preserves test behavior while enabling watch service in production.Testing
PYTEST_CURRENT_TESTis always set during pytest runstests/__init__.pyalso sets the env var for additional safetyconfig.is_test_envchecksPYTEST_CURRENT_TESTdirectly as a third condition———
Generated with Claude Code